<?php

/**
 * sfTestFunctionalExt tests an application by using a browser simulator.
 *
 * @package    flexiwik
 * @subpackage test
 * @author     Jonathan Olger Nieto Lajo <jonathan_nieto@hotmail.com>
 */
class sfTestFunctionalExt extends sfTestFunctional
{
  public function __construct(sfBrowserBase $browser, lime_test_ext $lime = null, $testers = array())
  {
    $testers = array_merge
               (
                 array
                 (
                   'doctrine'    => 'sfTesterDoctrine',
                   'file_system' => 'sfTesterFileSystem',
                 ),
                 $testers
               );
               
    if (is_null(self::$test))
    {
      self::$test = !is_null($lime) ? $lime : new lime_test_ext(null, new lime_output_color());
    }

    parent::__construct($browser, $lime, $testers);
  }
  
  /**
   * @return sfTestBrowser The current sfTestBrowser instance
   */
  public function login($email = 'jonathan.nieto@koechcorp.com', $password = 'symfony')
  {
  	$this->post
  	(
  	  '/login', 
  	  array
  	  (
  	    'login' => array
  	               (
  	                 'email'    => $email,
  	                 'password' => $password
  	               )
  	  )
  	);
  	
  	return $this;
  }
  /**
   * @return sfTestBrowser The current sfTestBrowser instance
   */
  public function logout()
  {
  	$this->get('/logout');
  	
  	return $this;
  }
}
